home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / CAD / LAUNCH36.ARJ / LC.LSP < prev    next >
Lisp/Scheme  |  1991-05-24  |  3KB  |  98 lines

  1.  
  2. ; LaunchCAD Autolisp program version 3.6
  3.  
  4. ; Note: add the line:     (load"lc")     to the end of your ACAD.LSP file.
  5. ; If you do not have an ACAD.LSP file then you can rename this file to ACAD.LSP
  6. ; or add the contents of this file to your present ACAD.LSP file.
  7.  
  8. (princ "\nLoading LaunchCAD...")
  9. (if(< (substr(getvar "ACADVER")1 2) "11")
  10.   (setvar "MENUECHO" 1))                        ; this makes INSERT work right
  11.  
  12. (defun lc_shell (mode dt / ce me dir f)         ; call LaunchCAD in shell mode
  13.   (setq ce (getvar "CMDECHO")
  14.     me (getvar "MENUECHO"))
  15.   (setvar "CMDECHO" 0)                          ; don't echo commands
  16.   (setvar "MENUECHO" 1)                         ; do echo menu commands
  17.   (if (= dt "d") (progn
  18.     (setq dir (getvar "DWGPREFIX"))
  19.   ) ;else
  20.     (setq dir ".")
  21.   )
  22.   (if (null dir) (setq dir "."))
  23. ; (command "sh" "mode co80")                    ; decomment for dual screen
  24.   (command "launchcad" (strcat dir " " mode))   ; invoke LaunchCAD
  25. ; (command "sh" "mode mono")                    ; decomment for dual screen
  26. ; (graphscr)                    ;    "           "
  27.   (if(null(setq username (getenv "USERNAME")))
  28.     (setq username "LC"))
  29.   (command ".SCRIPT" username)                  ; run the script
  30.   (close(open(findfile (strcat username ".SCR"))"w"))   ; just in case...
  31.   (setvar "CMDECHO" ce)                         ; restore CMDECHO
  32.   (setvar "MENUECHO" me)                        ; restore MENUECHO
  33.   (princ)
  34. )
  35.  
  36. ; Note: You may edit this lisp file to rename the following functions
  37. ; to any name that you wish so long as it does not conflict with an
  38. ; AutoCAD internal command.
  39.  
  40. ; Execute LaunchCAD from within AutoCAD (in shell mode)
  41.  
  42. (defun c:lc ()     (lc_shell "shell" "d"))
  43. (defun c:ins ()  (lc_shell "insert" "s"))       ; Insert Mode
  44. (defun c:lisp () (lc_shell "lisp" "s"))         ; Lisp Mode
  45. (defun c:dxf ()  (lc_shell "dxfin" "s"))        ; DXFIN Mode
  46. (defun c:dxb ()  (lc_shell "dxbin" "s"))        ; DXBIN Mode
  47. (defun c:vs ()     (lc_shell "vslide" "s"))       ; VSlide Mode
  48. (defun c:mu ()     (lc_shell "menu" "s"))         ; Menu Mode
  49. (defun fi ()
  50.   (command "LAUNCHCAD" ". FILE" )        ; invoke LaunchCAD file Mode
  51.   (princ)
  52. )
  53.  
  54. ; Redefine the QUIT command to run quit.scr in order to
  55. ; bypass the AutoCAD opening menu.
  56.  
  57. (defun c:quit ()
  58.   (setvar "CMDECHO" 0)
  59.   (initget "No Yes")
  60.   (if(= "Yes" (getkword
  61.     "\nDo you really want to discard\nall changes to drawing[y/N]: "))
  62.     (command ".SCRIPT" "QUIT"))
  63.   (princ)
  64. )
  65.  
  66. ; Redefine the END command to run end.scr in order to
  67. ; bypass the AutoCAD opening menu.
  68.  
  69. (defun c:end ()
  70.   (setvar "CMDECHO" 0)
  71.   (command ".SCRIPT" "END")              ; run end.scr which bypasses menu
  72.   (princ)
  73. )
  74.  
  75. (defun c:wend ()
  76.   (setvar "CMDECHO" 0)
  77.   (command ".SCRIPT" "WEND")              ; run wend.scr which saves drawing
  78.   (princ)                 ; using wblock * and bypasses menu
  79. )
  80.  
  81. ; Undefine the AutoCAD drawing editor END and QUIT commands so that
  82. ; the end and quit functions defined above will work in place of the
  83. ; internal commands (.end and .quit will still work like normal)
  84. ; NOTE: (lc:su) MUST be in STARTUP.LSP or the S::STARTUP function
  85. ; in ACAD.LSP
  86.  
  87. (defun lc:su()
  88.   (command "UNDEFINE" "QUIT")
  89.   (command "UNDEFINE" "END")
  90.   (princ "\nEND and QUIT commands redefined...")
  91.   (princ "\nLaunchCAD initialized.")
  92.   (princ)
  93. )
  94.  
  95. (princ "\nLaunchCAD ")
  96. (princ)
  97.  
  98.